package com.lemon.smartsafety.ui.activity.fire.item.statistics;

import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

import com.lemon.android.http.HttpUtils;
import com.lemon.android.http.LemonRequestParams;
import com.lemon.smartsafety.R;
import com.lemon.smartsafety.app.BundleKey;
import com.lemon.smartsafety.app.EventTag;
import com.lemon.smartsafety.app.IApplication;
import com.lemon.smartsafety.entity.RefreshViewEntity;
import com.lemon.smartsafety.entity.common.AreaVo;
import com.lemon.smartsafety.entity.common.SelectDataI;
import com.lemon.smartsafety.entity.common.UploadFileItem;
import com.lemon.smartsafety.entity.event.common.AreaSelectEvent;
import com.lemon.smartsafety.entity.main.OptionItemVo;
import com.lemon.smartsafety.entity.safe.company.CompanyInfo;
import com.lemon.smartsafety.http.HttpBack;
import com.lemon.smartsafety.http.HttpOkBase;
import com.lemon.smartsafety.http.HttpPath;
import com.lemon.smartsafety.listener.AreaType;
import com.lemon.smartsafety.result.BaseMode;
import com.lemon.smartsafety.result.fire.FireCompanyBaseScore;
import com.lemon.smartsafety.result.fire.SuperviseCompanyDetail;
import com.lemon.smartsafety.result.fire.SuperviseCompanyResult;
import com.lemon.smartsafetynew.ui.activity.base.PhotoSelectBaseActivity;
import com.lemon.smartsafety.ui.activity.fire.FirefightingUtil;
import com.lemon.smartsafety.ui.activity.safe.data.CompanyBasicThreePersonActivity;
import com.lemon.smartsafety.utils.CommonUtil;
import com.lemon.smartsafety.utils.JsonUtils;
import com.lemon.smartsafety.utils.LogUtils;
import com.lemon.smartsafety.utils.app.ToastUtils;
import com.lemon.smartsafety.utils.app.UIHelper;
import com.lemon.smartsafety.utils.app.UserTypeHelper;
import com.lemon.smartsafety.utils.common.StringUtils;
import com.lemon.smartsafety.utils.location.LocationBaiDuUtils;
import com.lemon.smartsafety.view.ViewFireTop;
import com.lemon.smartsafety.view.dialog.DialogSingleChose;
import com.zhy.http.okhttp.OkHttpUtils;

import org.greenrobot.eventbus.Subscribe;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import butterknife.Bind;
import cn.finalteam.galleryfinal.model.PhotoInfo;

public class CompanyStatisticsShowActivity extends PhotoSelectBaseActivity {


    @Bind(R.id.main_title)
    TextView mainTitle;
    @Bind(R.id.toolbar)
    Toolbar toolbar;
    @Bind(R.id.app_bar_layout)
    AppBarLayout appBarLayout;
    @Bind(R.id.fireTop)
    ViewFireTop fireTop;
    @Bind(R.id.metUnitName)
    TextView metUnitName;
    @Bind(R.id.metCode)
    TextView metCode;
    @Bind(R.id.metAddress)
    TextView metAddress;
    @Bind(R.id.metUnitProp)
    TextView metUnitProp;
    @Bind(R.id.metArea)
    TextView metArea;
    @Bind(R.id.txtLegalPersonTitle)
    TextView txtLegalPersonTitle;
    @Bind(R.id.txtLegalPerson)
    TextView txtLegalPerson;
    @Bind(R.id.txtLegalPersonCidTitle)
    TextView txtLegalPersonCidTitle;
    @Bind(R.id.txtLegalPersonCid)
    TextView txtLegalPersonCid;
    @Bind(R.id.txtLegalPersonPhoneTitle)
    TextView txtLegalPersonPhoneTitle;
    @Bind(R.id.txtLegalPersonPhone)
    TextView txtLegalPersonPhone;
    @Bind(R.id.txtFireManagerTitle)
    TextView txtFireManagerTitle;
    @Bind(R.id.txtFireManager)
    TextView txtFireManager;
    @Bind(R.id.txtFireManagerCidTitle)
    TextView txtFireManagerCidTitle;
    @Bind(R.id.txtFireManagerCid)
    TextView txtFireManagerCid;
    @Bind(R.id.txtFireManagerPhoneTitle)
    TextView txtFireManagerPhoneTitle;
    @Bind(R.id.txtFireManagerPhone)
    TextView txtFireManagerPhone;
    @Bind(R.id.txtFireResponsibleTitle)
    TextView txtFireResponsibleTitle;
    @Bind(R.id.txtFireResponsible)
    TextView txtFireResponsible;
    @Bind(R.id.txtFireResponsibleCidTitle)
    TextView txtFireResponsibleCidTitle;
    @Bind(R.id.txtFireResponsibleCid)
    TextView txtFireResponsibleCid;
    @Bind(R.id.txtFireResponsiblePhoneTitle)
    TextView txtFireResponsiblePhoneTitle;
    @Bind(R.id.txtFireResponsiblePhone)
    TextView txtFireResponsiblePhone;
    @Bind(R.id.rowPhotoPick)
    TableRow rowPhotoPick;
    @Bind(R.id.mSelectRecycleView)
    RecyclerView mSelectRecycleView;
    @Bind(R.id.tl_basic_info)
    TableLayout tlBasicInfo;
    @Bind(R.id.mainContainer)
    LinearLayout mainContainer;
    @Bind(R.id.metRegisterAddress)
    TextView metRegisterAddress;
    @Bind(R.id.rowUnitProp)
    TableRow rowUnitProp;
    @Bind(R.id.rowArea)
    TableRow rowArea;
    private String mApplicationCode;
    private CompanyInfo mCompanyInfo;

    private boolean isSaferOrMajor = false;

    private PhotoInfo mPhotoInfo;


    private SelectDataI mUnitProp = null;
    private SelectDataI mAreaProvince, mAreaCity, mAreaDistrict, mAreaStreet, mAreaVillage;

    private Map<String, String> mThreePersonValue = new HashMap<>();
    private LocationBaiDuUtils locationBaiDuUtils;

    private String[] mCapital = {"江苏", "浙江", "上海"};
    private String[] mCity = {"无锡", "苏州", "南通", "常州"};
    private String[] mDistrict = {"江阴", "宜兴", "梁溪区", "滨湖区", "新吴区", "锡山区", "惠山区"};

    private DialogSingleChose dialogSingleChose;

    private SuperviseCompanyResult.ResultEntity resultEntity;
    private FireCompanyBaseScore fireCompanyBaseScore;

    private SuperviseCompanyDetail.MyCompanyScoreListEntity myCompanyScoreListEntity;

    @Override
    protected void getBundleArgs() {
        super.getBundleArgs();
        if (getIntent().getExtras() != null) {
            resultEntity = (SuperviseCompanyResult.ResultEntity) getIntent().getSerializableExtra(BundleKey.FIRE_COMPANY_BASE_INFO);
            myCompanyScoreListEntity = (SuperviseCompanyDetail.MyCompanyScoreListEntity) getIntent().getSerializableExtra(BundleKey.FIRE_COMPANY_PRO_CODE);
        }
    }


    @Override
    protected void initTitle() {
        setBarTitle("单位信息完善率");
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_baseinfo_finish, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == R.id.action_baseinfo_finish) {
            //信息完善
            LogUtils.LOGE("信息完善");
            Bundle bundle = new Bundle();
            bundle.putSerializable(BundleKey.FIRE_COMPANY_BASE_INFO, resultEntity);
            bundle.putSerializable(BundleKey.FIRE_COMPANY_PRO_CODE, myCompanyScoreListEntity);
            UIHelper.showActivity(CompanyStatisticsShowActivity.this, bundle, CompanyStatisticsActivity.class);
        }
        return super.onOptionsItemSelected(item);
    }


    @Override
    protected void callFinish() {
        IApplication._tempBuildPropActivity = null;
        mCompanyInfo = null;
        mPhotoInfo = null;
        this.finish();
    }

    @Override
    protected int getContentViewId() {
        return R.layout.activity_company_statistics_show;
    }


    @Override
    protected void initViews() {
        super.initViews();
        //设置不可添加
        mSelectEvidenceAdapter.setCanAdd(false);
        setShowAdd(false);

        dialogSingleChose = new DialogSingleChose(this);

        fireTop.setTitleContent(resultEntity.getCompanyName());
        fireTop.setTitleSubContent("");
        fireTop.setNum1Content("0");
        fireTop.setNum2Content("/0");
        fireTop.setNum1Color(R.color.colorAppRed);
        fireTop.setNum2Color(R.color.colorAppBlue);
        fireTop.setImageCircleShow(true);
        fireTop.setImageCircleBg(R.drawable.shape_circle_red);


        metUnitProp.setTag("");
        metArea.setText("");

        isSaferOrMajor = UserTypeHelper.isSaferOrMajor();

        IApplication._tempBuildPropActivity = this;
        initTopHttp();
        initCompanyBase();
    }


    /**
     * 刷新View
     *
     * @param companyInfo
     */
    private void initValueView(CompanyInfo companyInfo) {

        metUnitName.setText(StringUtils.nullValue(companyInfo.getCompany_name()));
        metArea.setText(getAreaText(companyInfo));
        metCode.setText(StringUtils.nullValue(companyInfo.getCompany_code()));

        metRegisterAddress.setText(companyInfo.getRegister_address());

        String address = StringUtils.nullValue(companyInfo.getAddress());
        if (address.length() != 0) {
            metAddress.setText(StringUtils.nullValue(companyInfo.getAddress()));
        }

        String unitPropId = StringUtils.nullValue(companyInfo.getType_id());
        String unitPropTitle = StringUtils.nullValue(companyInfo.getType_title());
        if (unitPropId.length() != 0 && unitPropTitle.length() != 0) {
            OptionItemVo vo = new OptionItemVo();
            vo.setSelected(true);
            vo.setVoId(unitPropId);
            vo.setTitle(unitPropTitle);
            mUnitProp = vo;
            metUnitProp.setText(unitPropTitle);
            metUnitProp.setTag(unitPropId);
        } else {
            metUnitProp.setTag("");
        }


        removeLoadFileItems();
        List<UploadFileItem> oldPhotos = companyInfo.getFiles();
        if (null != oldPhotos && oldPhotos.size() != 0) {
            addUploadFileItems(oldPhotos);
        }
        /* 营业执照 */
        String licensePhoto = companyInfo.getLicense_photo();
        if (StringUtils.nullValue(licensePhoto).length() != 0) {
            String url = HttpUtils.formatFilesUrl(licensePhoto);
            this.mPhotoInfo = new PhotoInfo();
            mPhotoInfo.setPhotoId(Integer.MAX_VALUE);
            mPhotoInfo.setPhotoPath(url);
        }


        mThreePersonValue = getThreePersonInfoValue(companyInfo);
        //设置三类人员信息
        setThreePersonStatusText();


        if (CommonUtil.objIsEmpty(mUnitProp)) {
            finish();
        }

    }

    private boolean isMapEmpty(Map map) {
        if (map == null || map.isEmpty()) {
            return true;
        }
        return false;
    }

    @Subscribe
    public void onEventMainThread(RefreshViewEntity refreshViewEntity) {
        if (refreshViewEntity.getTAG().equals(CompanyStatisticsActivity.class.getName())) {
            initTopHttp();
            initCompanyBase();
        }
    }

    /**
     * 设置三类人员信息
     */
    private void setThreePersonStatusText() {

        if (!isMapEmpty(mThreePersonValue)) {
            txtLegalPerson.setText(StringUtils.nullValue(mThreePersonValue.get(CompanyBasicThreePersonActivity.kTxtLegalPerson)));
            txtLegalPersonCid.setText(StringUtils.nullValue(mThreePersonValue.get(CompanyBasicThreePersonActivity.kTxtLegalPersonCid)));
            txtLegalPersonPhone.setText(StringUtils.nullValue(mThreePersonValue.get(CompanyBasicThreePersonActivity.kTxtLegalPersonPhone)));

            txtFireManager.setText(StringUtils.nullValue(mThreePersonValue.get(CompanyBasicThreePersonActivity.kTxtFireManager)));
            txtFireManagerCid.setText(StringUtils.nullValue(mThreePersonValue.get(CompanyBasicThreePersonActivity.kTxtFireManagerCid)));
            txtFireManagerPhone.setText(StringUtils.nullValue(mThreePersonValue.get(CompanyBasicThreePersonActivity.kTxtFireManagerPhone)));

            txtFireResponsible.setText(StringUtils.nullValue(mThreePersonValue.get(CompanyBasicThreePersonActivity.kTxtFireResponsible)));
            txtFireResponsibleCid.setText(StringUtils.nullValue(mThreePersonValue.get(CompanyBasicThreePersonActivity.kTxtFireResponsibleCid)));
            txtFireResponsiblePhone.setText(StringUtils.nullValue(mThreePersonValue.get(CompanyBasicThreePersonActivity.kTxtFireResponsiblePhone)));


            setThreePColor(txtLegalPersonTitle, getEdtIsEmpty(txtLegalPerson));
            setThreePColor(txtLegalPersonCidTitle, getEdtIsEmpty(txtLegalPersonCid));
            setThreePColor(txtLegalPersonPhoneTitle, getEdtIsEmpty(txtLegalPersonPhone));


            setThreePColor(txtFireManagerTitle, getEdtIsEmpty(txtFireManager));
            setThreePColor(txtFireManagerCidTitle, getEdtIsEmpty(txtFireManagerCid));
            setThreePColor(txtFireManagerPhoneTitle, getEdtIsEmpty(txtFireManagerPhone));


            setThreePColor(txtFireResponsibleTitle, getEdtIsEmpty(txtFireResponsible));
            setThreePColor(txtFireResponsibleCidTitle, getEdtIsEmpty(txtFireResponsibleCid));
            setThreePColor(txtFireResponsiblePhoneTitle, getEdtIsEmpty(txtFireResponsiblePhone));


        }

    }


    /**
     * @param textView
     * @return
     */
    private boolean getEdtIsEmpty(TextView textView) {
        if (CommonUtil.strIsEmpty(textView.getText().toString().trim())) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * @param textView
     * @param isEmpty
     */
    private void setThreePColor(TextView textView, boolean isEmpty) {
        if (isEmpty) {
            textView.setTextColor(ContextCompat.getColor(this, R.color.colorAppRed));
        } else {
            textView.setTextColor(ContextCompat.getColor(this, R.color.colorTextPrimary));
        }
    }


    private String getAreaText(CompanyInfo infoVo) {
        StringBuilder sb = new StringBuilder();
        String title = StringUtils.nullValue(infoVo.getPlace_name_province());
        if (title.length() != 0) {
            sb.append(title);
            AreaVo vo = new AreaVo();
            vo.setSelectedI(true);
            vo.setTitle(title);
            vo.setVoId(StringUtils.nullValue(infoVo.getPosition_province_id()));
            mAreaProvince = vo;
        }

        String title2 = StringUtils.nullValue(infoVo.getPlace_name_city());
        if (title2.length() != 0) {
            sb.append("-" + title2);
            AreaVo vo = new AreaVo();
            vo.setSelectedI(true);
            vo.setTitle(title2);
            vo.setVoId(StringUtils.nullValue(infoVo.getPosition_city_id()));
            mAreaCity = vo;
        } else {
            mAreaCity = null;
            mAreaDistrict = null;
            mAreaStreet = null;
            mAreaVillage = null;
            return sb.toString();
        }

        String title3 = StringUtils.nullValue(infoVo.getPlace_name_district());
        if (title3.length() != 0) {
            sb.append("-" + title3);
            AreaVo vo = new AreaVo();
            vo.setSelectedI(true);
            vo.setTitle(title3);
            vo.setVoId(StringUtils.nullValue(infoVo.getPosition_district_id()));
            mAreaDistrict = vo;
        } else {
            mAreaDistrict = null;
            mAreaStreet = null;
            mAreaVillage = null;
            return sb.toString();
        }
        String title4 = StringUtils.nullValue(infoVo.getPlace_name_streets());
        if (title4.length() != 0) {
            sb.append("-" + title4);
            AreaVo vo = new AreaVo();
            vo.setSelectedI(true);
            vo.setTitle(title4);
            vo.setVoId(StringUtils.nullValue(infoVo.getPosition_streets_id()));
            mAreaStreet = vo;
        } else {
            mAreaStreet = null;
            mAreaVillage = null;
            return sb.toString();
        }

        String title5 = StringUtils.nullValue(infoVo.getPlace_name_village());
        if (title5.length() != 0) {
            sb.append("-" + title5);
            AreaVo vo = new AreaVo();
            vo.setSelectedI(true);
            vo.setTitle(title5);
            vo.setVoId(StringUtils.nullValue(infoVo.getPosition_village_id()));
            mAreaVillage = vo;
        } else {
            mAreaVillage = null;
        }
        return sb.toString();
    }

    @Subscribe
    public void onEventMainThread(AreaSelectEvent event) {
        if (AreaType.PROVINCE == event.getType()) {
            mAreaProvince = event.getData();
        } else if (AreaType.CITY == event.getType()) {
            mAreaCity = event.getData();
        } else if (AreaType.DISTRICT == event.getType()) {
            mAreaDistrict = event.getData();
        } else if (AreaType.STREET == event.getType()) {
            mAreaStreet = event.getData();
        } else if (AreaType.VILLAGE == event.getType()) {
            mAreaVillage = event.getData();
        }

        metArea.setText(getAreaViewValue());
    }

    private String getAreaViewValue() {
        StringBuilder sb = new StringBuilder();
        if (mAreaProvince != null) {
            String title = StringUtils.nullValue(mAreaProvince.getTitle());
            sb.append(title);
        } else {
            return sb.toString();
        }
        if (mAreaCity != null) {
            String title = StringUtils.nullValue(mAreaCity.getTitle());
            sb.append("-" + title);
        } else {
            mAreaCity = null;
            mAreaDistrict = null;
            mAreaStreet = null;
            mAreaVillage = null;
            return sb.toString();
        }

        if (mAreaDistrict != null) {
            String title = StringUtils.nullValue(mAreaDistrict.getTitle());
            sb.append("-" + title);
        } else {
            mAreaDistrict = null;
            mAreaStreet = null;
            mAreaVillage = null;
            return sb.toString();
        }


        if (mAreaStreet != null) {
            String title = StringUtils.nullValue(mAreaStreet.getTitle());
            sb.append("-" + title);
        } else {
            mAreaStreet = null;
            mAreaVillage = null;
            return sb.toString();
        }


        if (mAreaVillage != null) {
            String title = StringUtils.nullValue(mAreaVillage.getTitle());
            sb.append("-" + title);
        } else {
            mAreaVillage = null;
        }

        return sb.toString();
    }


    private Map<String, String> getThreePersonInfoValue(CompanyInfo infoVo) {
        Map<String, String> valueDic = new HashMap<>();
        if (StringUtils.nullValue(infoVo.getLegal_person()).length() != 0) {
            valueDic.put(CompanyBasicThreePersonActivity.kTxtLegalPerson, StringUtils.nullValue(infoVo.getLegal_person()));
        }
        if (StringUtils.nullValue(infoVo.getLegal_person_cid()).length() != 0) {
            valueDic.put(CompanyBasicThreePersonActivity.kTxtLegalPersonCid, StringUtils.nullValue(infoVo.getLegal_person_cid()));
        }
        if (StringUtils.nullValue(infoVo.getLegal_person_phone()).length() != 0) {
            valueDic.put(CompanyBasicThreePersonActivity.kTxtLegalPersonPhone, StringUtils.nullValue(infoVo.getLegal_person_phone()));
        }


        if (StringUtils.nullValue(infoVo.getFire_manager()).length() != 0) {
            valueDic.put(CompanyBasicThreePersonActivity.kTxtFireManager, StringUtils.nullValue(infoVo.getFire_manager()));
        }
        if (StringUtils.nullValue(infoVo.getFire_manager_cid()).length() != 0) {
            valueDic.put(CompanyBasicThreePersonActivity.kTxtFireManagerCid, StringUtils.nullValue(infoVo.getFire_manager_cid()));
        }
        if (StringUtils.nullValue(infoVo.getFire_manager_phone()).length() != 0) {
            valueDic.put(CompanyBasicThreePersonActivity.kTxtFireManagerPhone, StringUtils.nullValue(infoVo.getFire_manager_phone()));
        }


        if (StringUtils.nullValue(infoVo.getFire_responsible()).length() != 0) {
            valueDic.put(CompanyBasicThreePersonActivity.kTxtFireResponsible, StringUtils.nullValue(infoVo.getFire_responsible()));
        }
        if (StringUtils.nullValue(infoVo.getFire_responsible_cid()).length() != 0) {
            valueDic.put(CompanyBasicThreePersonActivity.kTxtFireResponsibleCid, StringUtils.nullValue(infoVo.getFire_responsible_cid()));
        }
        if (StringUtils.nullValue(infoVo.getFire_responsible_phone()).length() != 0) {
            valueDic.put(CompanyBasicThreePersonActivity.kTxtFireResponsiblePhone, StringUtils.nullValue(infoVo.getFire_responsible_phone()));
        }


        return valueDic;
    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            callFinish();
        }
        return super.onKeyDown(keyCode, event);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        OkHttpUtils.getInstance().cancelTag(EventTag.TAG_ONE_COMPANY);
        IApplication._tempBuildPropActivity = null;
    }


    public void initTopHttp() {
        LemonRequestParams params = new LemonRequestParams("application_user_bind", "bind_id", "");
        params.put("company_code", resultEntity.getCompanyCode());
        params.put("radio_code", myCompanyScoreListEntity.getTargetCode());

        mHUDUtil.show();
        HttpOkBase.httpBasePost(params, HttpPath.getmBase(HttpPath.Get_score), "", new HttpOkBase.HttpInterface() {
            @Override
            public void callBackFunction(boolean httpClient, String result) {

                mHUDUtil.hidden();
                if (httpClient) {
                    BaseMode baseMode = JsonUtils.fromJson(result, BaseMode.class);
                    if (!CommonUtil.objIsEmpty(baseMode)) {
                        if (HttpBack.httpBackError(baseMode)) {

                            try {
                                fireCompanyBaseScore = mGson.fromJson(mGson.toJson(baseMode.getResult()), FireCompanyBaseScore.class);
                                initTopScore();
                            } catch (Exception e) {
                                e.printStackTrace();
                            }

                        } else {
                            ToastUtils.toastMsg(baseMode.getMsg());
                        }
                    }
                }
            }
        });

    }

    /**
     * 初始化顶部信息
     */
    private void initTopScore() {
        fireTop.setNum1Color(FirefightingUtil.getScoreTextColor(fireCompanyBaseScore.getStatus()));
        fireTop.setNum2Color(R.color.colorAppBlue);
        fireTop.setNum1Content(fireCompanyBaseScore.getCompanyScore());
        fireTop.setNum2Content("/" + fireCompanyBaseScore.getAvgScore());
        fireTop.setImageCircleBg(FirefightingUtil.getScoreImgCircleColor(fireCompanyBaseScore.getStatus()));
    }


    public void initCompanyBase() {
        LemonRequestParams params = new LemonRequestParams("application_user_bind", "bind_id", "");
        params.put("company_code", resultEntity.getCompanyCode());

        mHUDUtil.show();
        HttpOkBase.httpBasePost(params, HttpPath.getmBase(HttpPath.Get_one_company_by_id), "", new HttpOkBase.HttpInterface() {
            @Override
            public void callBackFunction(boolean httpClient, String result) {

                mHUDUtil.hidden();
                if (httpClient) {
                    BaseMode baseMode = JsonUtils.fromJson(result, BaseMode.class);
                    if (!CommonUtil.objIsEmpty(baseMode)) {
                        if (HttpBack.httpBackError(baseMode)) {

                            try {
                                mCompanyInfo = mGson.fromJson(mGson.toJson(baseMode.getResult()), CompanyInfo.class);
                                if (!CommonUtil.objIsEmpty(mCompanyInfo)) {
                                    initValueView(mCompanyInfo);
                                } else {
                                    mHUDUtil.showErrorTip("出错了");
                                }

                            } catch (Exception e) {
                                e.printStackTrace();
                            }

                        } else {
                            mHUDUtil.showErrorTip(baseMode.getMsg());
                        }
                    }
                }
            }
        });

    }



}
